package com.rocket.controller;


import com.rocket.entity.Notice;
import com.rocket.mq.NoticeTopicProducer;
import com.rocket.route.TopicKey;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author huan
 * @Date 2025/6/30
 */
@RestController
@RequestMapping("/rocket")
public class RocketController {

    @Autowired
    NoticeTopicProducer noticeTopicProducer;

    @PostMapping("/sent/notice")
    public Notice sentNotice(@RequestBody Notice notice) {
        noticeTopicProducer.sendNoticeMessage(TopicKey.MQ_KEY_NOTICE, notice);
        return notice;
    }
}
